﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using Shimpossible.Vonage;

namespace Example
{

    class Program
    {

        static void Main(string[] args)
        {
            Console.Write("User: ");
            string u = Console.ReadLine();
            Console.Write("Pass: ");
            string p = Console.ReadLine();
            HttpVonageConnection c = new HttpVonageConnection();
            c.Open(u,p);

            // show last 10 callers
            int i = 0;
            foreach (CallRecord cr in c.Activity())
            {
                if (i++ == 10) break;
                Console.WriteLine("From: " + cr.fromNumber + " " + cr.callerName);
            }

            foreach (VoiceMail v in c.Voicemail())
            {
                Console.WriteLine("Message from : " + v.From);

                // the .net SoundPlayer will not play the compressed wav files :-/
                //WavPlayer wp = new WavPlayer(v.Stream);
                //wp.Play();
                Console.WriteLine("Waiting...");
                Console.ReadLine();
                //wp.Stop();
            }


            c.Close();


            Console.WriteLine("Done");
        }
    }
}
